//
//  MXFindItemDetailWebViewVC.m
//  MXの衣柜
//
//  Created by 马霄 on 15/8/25.
//  Copyright (c) 2015年 霄 马. All rights reserved.
//

#import "MXFindItemDetailWebViewVC.h"
#import "MBProgressHUD.h"
@interface MXFindItemDetailWebViewVC ()<UIWebViewDelegate>
@property (nonatomic, retain) UIWebView *webView;
@property (nonatomic, retain) MBProgressHUD *HUD;
@property (nonatomic, retain) UIView *alterView;
@end

@implementation MXFindItemDetailWebViewVC
- (void)dealloc
{
    [_HUD release];
    [_alterView release];
    [_TitleString release];
    [_webView release];
    [_requestString release];
    [super dealloc];
}
-(void)viewWillAppear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = YES;
    [self uiActivityindicatorviewStart];
}
-(void)viewDidAppear:(BOOL)animated
{
    [self uiActivityindicatorviewEnd];
}
-(void)viewWillDisappear:(BOOL)animated
{
    self.tabBarController.tabBar.hidden = YES;
    //    self.navigationController.navigationBarHidden = NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = self.TitleString;
    self.navigationController.navigationBarHidden = NO;
    self.webView = [[[UIWebView alloc] initWithFrame:CGRectMake(0, HEIGHTPRO * 0, WIDTH, HEIGHT - HEIGHTPRO * 64)] autorelease];
    self.webView.delegate = self;
    self.webView.userInteractionEnabled = YES;
    
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.requestString]];
    [self.view addSubview:self.webView];
    
    [self.webView loadRequest:request];
    // Do any additional setup after loading the view.
    /*{
     UILabel *titleLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHTPRO * 64)] autorelease];
     titleLabel.backgroundColor = [UIColor whiteColor];
     titleLabel.userInteractionEnabled = YES;
     titleLabel.text = @"";
     [self.view addSubview:titleLabel];
     
     UILabel *ItemTitleLabel = [[[UILabel alloc] initWithFrame:CGRectMake(WIDTH / 2 - WIDTHPRO * 40, HEIGHTPRO * 24, WIDTHPRO * 80, HEIGHTPRO * 40)] autorelease];
     ItemTitleLabel.text = @"手机天猫店铺首页";
     ItemTitleLabel.text = self.TitleString;
     ItemTitleLabel.textAlignment = NSTextAlignmentCenter;
     ItemTitleLabel.font = [UIFont systemFontOfSize:16];
     [ItemTitleLabel setTextColor:[UIColor redColor]];
     [titleLabel addSubview:ItemTitleLabel];
     
     UIButton *backButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
     backButton.frame = CGRectMake(WIDTHPRO * 10, HEIGHTPRO * 29, WIDTHPRO * 20, HEIGHTPRO * 20);
     backButton.backgroundColor = [UIColor clearColor];
     [backButton setBackgroundImage:[UIImage imageNamed:@"Tmall_back"] forState:(UIControlStateNormal)];
     [backButton addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
     [titleLabel addSubview:backButton];
     }*/
    
    
    // Do any additional setup after loading the view.
}
-(void)uiActivityindicatorviewStart
{
    self.alterView =[[[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)] autorelease];
    self.alterView.backgroundColor =[UIColor whiteColor];
    self.HUD = [MBProgressHUD showHUDAddedTo:self.alterView animated:YES];
//    self.HUD.labelText = @"正在努力的给您加载";
    [self.HUD show:YES];
    
    [self.view addSubview:self.alterView];
    
}
-(void)uiActivityindicatorviewEnd
{
    [self.alterView removeFromSuperview];
}
-(void)viewDidDisappear:(BOOL)animated
{
    self.navigationController.navigationBarHidden = NO;
}

- (void)backAction
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
